{%include file="index.header.tpl.php"%}
{%include file="index.left.tpl.php"%}
  <!--主要内容开始-->
  <div class="content-wrapper">
    <section class="content">
      <div class="row">
          <section class="col-lg-2 connectedSortable" style=" padding-right:0px;">
            <div>
                <a href="index.php?a=resources.index" class="btn btn-default">教学资源</a>
                <a href="index.php?a=resources.collect" class="btn btn-default">我的收藏</a>
            </div>
           <div class="sidebar" style="background-color:#fff; padding-bottom:0px; border:1px solid #ddd; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);"> 
             <ul class="sidebar-menu" id="chan">
             {%foreach from=$grade_lists key=key item=value%}
                    <li class="treeview">
                      <a class="grade_id" href="#" target="view_blank">
                        <i class="glyphicon glyphicon-align-left"></i> <span>{%$value.grade_name%}</span> <i class="fa fa-angle-left pull-right"></i>
                          <ul class="treeview-menu" style="background-color:#fff;">
                            <li><a href="index.php?a=resources.index&grade_id={%$val.grade_id%}"><i class="fa fa-angle-right" target="view_blank"></i>全部</a></li>
                          {%foreach from=$class_lists key=keys item=val%}
                            <li><a href="index.php?a=resources.index&grade_id={%$val.grade_id%}&class_id={%$val.class_id%}"><i class="fa fa-angle-right" target="view_blank"></i>{%$val.class_name%}</a></li>
                         {%/foreach%}
                          </ul>
                    </li>
                    {%/foreach%}
              </ul>      
            </div>   
        </section>
        <!--树状图结束-->
        <section class="col-lg-10 connectedSortable">
         <div class="box box-default box-solid">
             <form action="index.php?a=resources.search" method="post"> 
                <div class="box-header with-border">
                    <span class="fa fa-pagelines" style="float:left; font-size:18px; padding-top:3px; color:#3c8dbc;" ></span>
                    <p class="box-title">我的资源</p>
          
                </div>
                <div class="box-body">
                    <div class="form-group" style="margin-bottom:5px;">
                       <a href="index.php?a=resources.index" class="btn btn-success btn-sm" target="view_blank">全部分类</a>
                       {%foreach from=$dir_lists key=keyd item=dir%}
                       <a href="index.php?a=resources.type&dir_id={%$dir.dir_id%}" class="dir_type" target="view_blank">{%$dir.dir_name%}</a>
                       {%/foreach%}
                       <a href="index.php?a=resources.add" class="btn btn-primary btn-sm" style="float:right;">当前添加</a>
                    </div>
                    <div class="form-group" style="margin-bottom:20px;">
                       <a href="index.php?a=resources.index" class="btn btn-success btn-sm" target="view_blank">全部格式</a>
                       {%foreach from=$file_lists key=keyf item=file%}
                       <a href="index.php?a=resources.list&file_type={%$file.file_type%}" class="file_type" target="view_blank">{%$file.file_type%}</a>
                       {%/foreach%}
                    </div>
                    <div class="col-md-3 form-group" style="padding:0;">
              <label for="inputPassword3" class="col-sm-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500; margin:0;">
                 标题：
              </label>
              <div class="input-group col-md-9 col-xs-12">
                 <input type="text" class="form-control" value="" name="file_theme">
              </div> 
            </div>
          <div class="col-md-3 form-group" style="padding:0;">
              <label for="inputPassword3" class="col-sm-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500; margin:0;">
                 上传人：
              </label>
              <div class="input-group col-md-9 col-xs-12">
                 <select class="form-control" name="class_id" >
                 {%foreach from=$user_lists key=keyu item=us%}
                    <option value="{%$us.class_id%}">{%$us.class_name%}</option>
                {%/foreach%}   
                 </select>
              </div> 
            </div>
          <div class="col-md-5 col-xs-12 form-group" style="padding:0;">
              <label for="inputPassword3" class="col-sm-2 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500; ">
                 时间：
              </label>
              <div class="input-group col-md-4" style="float:left;">
                 <input type="text" class="form-control" value="" id="from" name="file_date">
                   <div class="input-group-addon" style="padding:6px 7px;">
                  <i class="fa fa-calendar"></i>
                 </div>
              </div>           
            </div>
          <div class="col-md-1 col-xs-12">
             <button type="submit" class="btn btn-warning">查 询</button>
          </div>
              </form>
          <div style="clear:both; height:10px;"></div>
                     <table class="table table-bordered bai"  id="mytable">
                                <thead>
                                    <tr>
                                        <td>标题</td>
                                        <td>分类</td>
                                        <td>格式</td>
                                        <td>上传人</td>
                                        <td>大小
                                           <i class="fa fa-sort-amount-asc"></i><i class="fa fa-sort-amount-desc"></i>
                                         </td>
                                        <td>上传时间</td>
                                        <td  width="124">操作</td>
                                        <td width="70">下载次数</td>
                                    </tr> 
                                </thead>
                                <tbody>
                                 {%foreach from=$name_lists key=keyn item=fn%}
                                    <tr>
                                        <td>{%$fn.file_theme%}</td>
                                        <td>{%$fn.dir_name%}</td>
                                        <td>{%$fn.file_type%}</td>
                                        <td>{%$fn.class_name%}</td>
                                        <td>{%$fn.file_size%}</td>
                                        <td>{%$fn.file_date%}</td>
                                        <td>
                                            <a href="index.php?a=resources.info&file_id={%$fn.file_id%}" class="wide" target="view_blank">阅</a>
                                            <a href="index.php?a=resources.down&file_id={%$fn.file_id%}" class="wide" target="view_blank">下</a>
                                            <a href="index.php?a=resources.update&file_id={%$fn.file_id%}" class="wide" target="view_blank">改</a>
                                           <a href="index.php?a=resources.ext&file_id={%$fn.file_id%}" class="wide" target="view_blank">藏</a>
                                            <a href="index.php?a=resources.del&file_id={%$fn.file_id%}" onclick="if(confirm('警告！确认删除信息?')==false)return false;" class="wide" >删</a>
                                        </td>
                                        <td>{%$fn.file_down%}</td>

                                    </tr>
                                     {%/foreach%}   
                            </tbody>
                        </table>
           </div><!--box-body -->
           
               {%$page%}
           </div><!--box box-default box-solid-->
        </section>   
           
        </div><!--row-->
    </section>
 </div>
  <!--主要内容结束--> 
   {%include file="index.footer.tpl.php"%}
 <script>
  $(function() {
    $( "#from" ).datepicker({
      defaultDate: "+1w",
      changeMonth: true,
	  changeYear: true,
      numberOfMonths:1,
      onClose: function( selectedDate ) {
        $( "#to" ).datepicker( "option", "minDate", selectedDate );
      }
    });
    $( "#to" ).datepicker({
      defaultDate: "+1w",
      changeMonth: true,
      changeYear: true,
      numberOfMonths:1,
      onClose: function( selectedDate ) {
        $( "#from" ).datepicker( "option", "maxDate", selectedDate );
      }
    });
  });
  </script>

<script type="text/javascript">
   $(function(){
     $(".grade_id").click(function(){
        grade_id=$(".grade_id").attr("href")
        window.location=grade_id;
     })
   })
</script>
 
